var express = require('express');
var router = express.Router();

// 判断是否登录中间件

function isLogin(req, res, next) {
  if (req.session.userName == undefined) {
    res.send('未登录')
  } else {
    // 已登录进去正常页面
    next()
  }
}
router.use(isLogin)

/* GET users listing. */
router.get('/', (req, res, next) => {
  res.send('respond with a resource');
});

module.exports = router;
